<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>MiXiM: TestApplication Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">MiXiM
   &#160;<span id="projectnumber">2.3</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('a00207.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-attribs">Protected Attributes</a> &#124;
<a href="#pri-methods">Private Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">TestApplication Class Reference</div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="TestApplication" --><!-- doxytag: inherits="BaseModule" --><div class="dynheader">
Inheritance diagram for TestApplication:</div>
<div class="dyncontent">
<div class="center"><img src="a01033.png" border="0" usemap="#TestApplication_inherit__map" alt="Inheritance graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<div class="dynheader">
Collaboration diagram for TestApplication:</div>
<div class="dyncontent">
<div class="center"><img src="a01034.png" border="0" usemap="#TestApplication_coll__map" alt="Collaboration graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>

<p><a href="a01035.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00207.html#adc3a512816290a38b548f973bba993e7">initialize</a> (int stage)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Basic initialization for all modules.  <a href="#adc3a512816290a38b548f973bba993e7"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0b7f4db11451905159985b9f0632ed9d"></a><!-- doxytag: member="TestApplication::handleMessage" ref="a0b7f4db11451905159985b9f0632ed9d" args="(cMessage *msg)" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><b>handleMessage</b> (cMessage *msg)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7d4f47952d0129aed89583322e64798e"></a><!-- doxytag: member="TestApplication::finish" ref="a7d4f47952d0129aed89583322e64798e" args="()" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><b>finish</b> ()</td></tr>
<tr><td colspan="2"><h2><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab21991fe139bbdf61e1be5fd72204ad8"></a><!-- doxytag: member="TestApplication::dataOut" ref="ab21991fe139bbdf61e1be5fd72204ad8" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><b>dataOut</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a79f1ca1aa535e6f26e3379fbc896af38"></a><!-- doxytag: member="TestApplication::dataIn" ref="a79f1ca1aa535e6f26e3379fbc896af38" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><b>dataIn</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a51548c2716a2a2ce5053095dfd0c9597"></a><!-- doxytag: member="TestApplication::ctrlOut" ref="a51548c2716a2a2ce5053095dfd0c9597" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><b>ctrlOut</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa8308be564cf8bff13a2799ee7016f74"></a><!-- doxytag: member="TestApplication::ctrlIn" ref="aa8308be564cf8bff13a2799ee7016f74" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><b>ctrlIn</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac1c65132d2cccd336f188817f5ef517a"></a><!-- doxytag: member="TestApplication::delayTimer" ref="ac1c65132d2cccd336f188817f5ef517a" args="" -->
cMessage *&#160;</td><td class="memItemRight" valign="bottom"><b>delayTimer</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3b02990ad73d4921ac736e8748ce62c2"></a><!-- doxytag: member="TestApplication::nbPackets" ref="a3b02990ad73d4921ac736e8748ce62c2" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><b>nbPackets</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa254722de1f3f20b18800ee91e553f66"></a><!-- doxytag: member="TestApplication::remainingPackets" ref="aa254722de1f3f20b18800ee91e553f66" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><b>remainingPackets</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a85370247ea4783a5b11283f5c0f4aaa6"></a><!-- doxytag: member="TestApplication::headerLength" ref="a85370247ea4783a5b11283f5c0f4aaa6" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><b>headerLength</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab1dd707f51794dac6d534b0f8bead812"></a><!-- doxytag: member="TestApplication::nodeAddr" ref="ab1dd707f51794dac6d534b0f8bead812" args="" -->
<a class="el" href="a00117.html#ad85cd9e8d9e7e9cd5d02dd740c4a12a4">LAddress::L3Type</a>&#160;</td><td class="memItemRight" valign="bottom"><b>nodeAddr</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa499f99684c3c5774a591567993f8c5f"></a><!-- doxytag: member="TestApplication::dstAddr" ref="aa499f99684c3c5774a591567993f8c5f" args="" -->
<a class="el" href="a00117.html#ad85cd9e8d9e7e9cd5d02dd740c4a12a4">LAddress::L3Type</a>&#160;</td><td class="memItemRight" valign="bottom"><b>dstAddr</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9cd52c9bdb932f4ea7cc6e41ca85b19a"></a><!-- doxytag: member="TestApplication::trafficParam" ref="a9cd52c9bdb932f4ea7cc6e41ca85b19a" args="" -->
double&#160;</td><td class="memItemRight" valign="bottom"><b>trafficParam</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae1dc3152139c63611b74226ceb849e09"></a><!-- doxytag: member="TestApplication::debug" ref="ae1dc3152139c63611b74226ceb849e09" args="" -->
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00207.html#ae1dc3152139c63611b74226ceb849e09">debug</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Debug switch for all other modules. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7ab456a584e497917b78846e83f41f6b"></a><!-- doxytag: member="TestApplication::stats" ref="a7ab456a584e497917b78846e83f41f6b" args="" -->
bool&#160;</td><td class="memItemRight" valign="bottom"><b>stats</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1e73785222e60c8661ffac5f932ab04b"></a><!-- doxytag: member="TestApplication::trace" ref="a1e73785222e60c8661ffac5f932ab04b" args="" -->
bool&#160;</td><td class="memItemRight" valign="bottom"><b>trace</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8f2cfc6f9217d0a956cdced5fe378614"></a><!-- doxytag: member="TestApplication::flood" ref="a8f2cfc6f9217d0a956cdced5fe378614" args="" -->
bool&#160;</td><td class="memItemRight" valign="bottom"><b>flood</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af894aa90b03042f7859df3bbdd68a435"></a><!-- doxytag: member="TestApplication::isTransmitting" ref="af894aa90b03042f7859df3bbdd68a435" args="" -->
bool&#160;</td><td class="memItemRight" valign="bottom"><b>isTransmitting</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8c705b62d519c2ee04d9840aa88987b3"></a><!-- doxytag: member="TestApplication::INITIAL_DELAY" ref="a8c705b62d519c2ee04d9840aa88987b3" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><b>INITIAL_DELAY</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a348fb0d4eeb6f84c1e42ad58fe5c9d06"></a><!-- doxytag: member="TestApplication::PAYLOAD_SIZE" ref="a348fb0d4eeb6f84c1e42ad58fe5c9d06" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><b>PAYLOAD_SIZE</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af769fb6025a97bd3d1880694be8b5ae5"></a><!-- doxytag: member="TestApplication::nbPacketsReceived" ref="af769fb6025a97bd3d1880694be8b5ae5" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><b>nbPacketsReceived</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a170766132ed588154d393bd483a0a4d2"></a><!-- doxytag: member="TestApplication::latencies" ref="a170766132ed588154d393bd483a0a4d2" args="" -->
std::vector&lt; cStdDev &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>latencies</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa4ac0e0de6ebef3a9f70aaaf89b5b1d4"></a><!-- doxytag: member="TestApplication::latenciesRaw" ref="aa4ac0e0de6ebef3a9f70aaaf89b5b1d4" args="" -->
cOutVector&#160;</td><td class="memItemRight" valign="bottom"><b>latenciesRaw</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa2c9f935c704f942fe88818f7699c33d"></a><!-- doxytag: member="TestApplication::testStat" ref="aa2c9f935c704f942fe88818f7699c33d" args="" -->
cStdDev&#160;</td><td class="memItemRight" valign="bottom"><b>testStat</b></td></tr>
<tr><td colspan="2"><h2><a name="pri-methods"></a>
Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a230c6b18eef2dacee602d65fb4a6c6e8"></a><!-- doxytag: member="TestApplication::TestApplication" ref="a230c6b18eef2dacee602d65fb4a6c6e8" args="(const TestApplication &amp;)" -->
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00207.html#a230c6b18eef2dacee602d65fb4a6c6e8">TestApplication</a> (const <a class="el" href="a00207.html">TestApplication</a> &amp;)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Copy constructor is not allowed. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a517f1051a8160b5ebae3d10c27c19532"></a><!-- doxytag: member="TestApplication::operator=" ref="a517f1051a8160b5ebae3d10c27c19532" args="(const TestApplication &amp;)" -->
<a class="el" href="a00207.html">TestApplication</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00207.html#a517f1051a8160b5ebae3d10c27c19532">operator=</a> (const <a class="el" href="a00207.html">TestApplication</a> &amp;)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Assignment operator is not allowed. <br/></td></tr>
</table>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="adc3a512816290a38b548f973bba993e7"></a><!-- doxytag: member="TestApplication::initialize" ref="adc3a512816290a38b548f973bba993e7" args="(int stage)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void TestApplication::initialize </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>stage</em></td><td>)</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Basic initialization for all modules. </p>
<p>Subscription should be in stage==0, and firing notifications in stage==1 or later.</p>
<p>NOTE: You have to call this in the <a class="el" href="a00207.html#adc3a512816290a38b548f973bba993e7" title="Basic initialization for all modules.">initialize()</a> function of the inherited class! </p>

<p>Reimplemented from <a class="el" href="a00027.html#a03030e439aaf030c83da6e71e8be2f80">BaseModule</a>.</p>

<p>References <a class="el" href="a00207.html#ae1dc3152139c63611b74226ceb849e09">debug</a>, and <a class="el" href="a00027.html#af7e5a2e34b218afcc9b92d75e5e11df8">BaseModule::getNode()</a>.</p>
<div class="fragment"><pre class="fragment">                                          {
    <a class="code" href="a00207.html#adc3a512816290a38b548f973bba993e7" title="Basic initialization for all modules.">BaseModule::initialize</a>(stage);


    <span class="keywordflow">if</span> (stage == 0) {
        <span class="comment">// begin by connecting the gates</span>
        <span class="comment">// to allow messages exchange</span>
        dataOut = findGate(<span class="stringliteral">&quot;lowerLayerOut&quot;</span>);
        dataIn = findGate(<span class="stringliteral">&quot;lowerLayerIn&quot;</span>);
        ctrlOut = findGate(<span class="stringliteral">&quot;lowerControlOut&quot;</span>);
        ctrlIn  = findGate(<span class="stringliteral">&quot;lowerControlIn&quot;</span>);

        <span class="comment">// Retrieve parameters</span>
        <a class="code" href="a00207.html#ae1dc3152139c63611b74226ceb849e09" title="Debug switch for all other modules.">debug</a> = par(<span class="stringliteral">&quot;debug&quot;</span>).boolValue();
        stats = par(<span class="stringliteral">&quot;stats&quot;</span>).boolValue();
        trace = par(<span class="stringliteral">&quot;trace&quot;</span>).boolValue();

        isTransmitting    = <span class="keyword">false</span>;

        nbPackets         = par(<span class="stringliteral">&quot;nbPackets&quot;</span>);
        trafficParam      = par(<span class="stringliteral">&quot;trafficParam&quot;</span>).doubleValue();
        nodeAddr          = <a class="code" href="a00117.html#ad85cd9e8d9e7e9cd5d02dd740c4a12a4" title="Type definition for a L3 (Network) address.">LAddress::L3Type</a>( par(<span class="stringliteral">&quot;nodeAddr&quot;</span>).longValue() );
        dstAddr           = <a class="code" href="a00117.html#ad85cd9e8d9e7e9cd5d02dd740c4a12a4" title="Type definition for a L3 (Network) address.">LAddress::L3Type</a>( par(<span class="stringliteral">&quot;dstAddr&quot;</span>).longValue() );
        flood             = par(<span class="stringliteral">&quot;flood&quot;</span>).boolValue();
        PAYLOAD_SIZE      = par(<span class="stringliteral">&quot;payloadSize&quot;</span>); <span class="comment">// data field size</span>
        PAYLOAD_SIZE      = PAYLOAD_SIZE * 8; <span class="comment">// convert to bits</span>
        <span class="comment">// Configure internal state variables and objects</span>
        nbPacketsReceived = 0;
        remainingPackets  = nbPackets;

        INITIAL_DELAY     = 5; <span class="comment">// initial delay before sending first packet</span>

        <span class="comment">// start timer if needed</span>
        <span class="keywordflow">if</span> (nodeAddr != 0 &amp;&amp; remainingPackets &gt; 0) {
            delayTimer = <span class="keyword">new</span> cMessage(<span class="stringliteral">&quot;app-delay-timer&quot;</span>);
            scheduleAt(simTime() + INITIAL_DELAY +uniform(0,0.001), delayTimer); <span class="comment">// we add a small shift to avoid systematic collisions</span>
        } <span class="keywordflow">else</span> {
            delayTimer = 0;
        }

        <span class="keywordflow">if</span> (stats) {
            <span class="comment">// we should collect statistics</span>
            <span class="keywordtype">int</span> nbNodes = <a class="code" href="a00027.html#af7e5a2e34b218afcc9b92d75e5e11df8" title="Get a reference to the local node module.">getNode</a>()-&gt;size();
            <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; nbNodes; i++) {
                std::ostringstream oss;
                oss &lt;&lt; <span class="stringliteral">&quot;latency&quot;</span>;
                oss &lt;&lt; i;
                cStdDev aLatency(oss.str().c_str());
                latencies.push_back(aLatency);
            }
        }

        <span class="keywordflow">if</span> (trace) {
            <span class="comment">// record all packet arrivals</span>
            latenciesRaw.setName(<span class="stringliteral">&quot;rawLatencies&quot;</span>);
        }

    }

}
</pre></div>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>D:/Projects/MiXiM/extsrc/mixim/src/modules/application/<a class="el" href="a00416_source.html">TestApplication.h</a></li>
<li>D:/Projects/MiXiM/extsrc/mixim/src/modules/application/TestApplication.cc</li>
</ul>
</div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="a00207.html">TestApplication</a>      </li>

    <li class="footer">Generated on Tue Mar 5 2013 21:26:33 for MiXiM by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
   </ul>
 </div>


</body>
</html>
